#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int tre[N * 32][2];
int a[N];
int idx;
void insert(int x)
{
    int cnt = 0;
    for (int i = 31; i >= 0; i--)
    {
        int path = ((x >> i) & 1);
        if (tre[cnt][path] == 0)
        {
            tre[cnt][path] = ++idx;
        }
        cnt = tre[cnt][path];
    }
}
int find(int x)
{
    int cnt = 0;
    int ret = 0;
    for (int i = 31; i >= 0; i--)
    {
        int path = ((x >> i) & 1);
        if (tre[cnt][path ^ 1])
        {
            ret |= (1 << i);
            cnt = tre[cnt][path ^ 1];
        }
        else
            cnt = tre[cnt][path];
    }
    return ret;
}
int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        insert(a[i]);
    }
    int ret = 0;
    for (int i = 1; i <= n; i++)
    {
        ret = max(ret, find(a[i]));
    }
    cout << ret << endl;
    return 0;
}